<template>
  <div class="flex_col">
    <div>
      <van-swipe class="my-swipe"
                 indicator-color="white"
                 :loop="false">
        <van-swipe-item class="flex_row">
          <!-- 第一块 -->
          <div class="flex1 flex_col pdt20"
               style="margin-left:8%">
            <div class="block1 flex_col">
              <div class="blockt1">累计发电|千瓦时</div>
              <div class="blockt2">2530</div>
              <div><label class="blockt3">同比</label><label class="blockt4">3.14 ⬆</label></div>
            </div>

            <div class="block1 flex_col">
              <div class="blockt1">累计发电|千瓦时</div>
              <div class="blockt2">2530</div>
              <div><label class="blockt3">同比</label><label class="blockt4">3.14 ⬆</label></div>
            </div>
          </div>

          <!-- 第二块 -->
          <div class="flex1  flex_col pdt20">
            <div class="block1 flex_col">
              <div class="blockt1">累计发电|千瓦时</div>
              <div class="blockt2">2530</div>
              <div><label class="blockt3">同比</label><label class="blockt4">3.14 ⬆</label></div>
            </div>

            <div class="block1 flex_col">
              <div class="blockt1">累计发电|千瓦时</div>
              <div class="blockt2">2530</div>
              <div><label class="blockt3">同比</label><label class="blockt4">3.14 ⬆</label></div>
            </div>
          </div>

        </van-swipe-item>
        <van-swipe-item>2</van-swipe-item>
        <van-swipe-item>3</van-swipe-item>
        <van-swipe-item>4</van-swipe-item>
      </van-swipe>

    </div>

    <!-- echart图 -->
    <div id="main1"></div>
    <div id="main2"></div>
  </div>
</template>
<script>
import Vue from 'vue';
import { Swipe, SwipeItem } from 'vant';
// import echarts from 'echarts'
Vue.use(Swipe).use(SwipeItem);
export default {
  name: 'dlzl',
  props: {
    echarts: {
      type: Object,
      default: null
    }
  },
  data () {
    return {
      chart: null
    }
  },

  methods: {
    drawPie (id) {
      console.log('执行了dlzl的方法')
      this.chart = this.echarts.init(document.getElementById(id))
      // 绘制图表
      this.chart.setOption({
        title: { text: '在Vue中使用echarts' },
        tooltip: {},
        xAxis: {
          data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
        },
        yAxis: {},
        series: [{
          name: '销量',
          type: 'bar',
          data: [5, 20, 36, 10, 10, 20]
        }]
      });
    }
  },
  mounted () {
    console.log(this)
    this.$nextTick(function () {
      // this.drawPie('main1')
      // this.drawPie('main2')
    })
  },
  destroyed () {
  },
}

</script>

<style lang="less" scoped>
.my-swipe .van-swipe-item {
  height: 280px;
  background: url("../../assets/images/swipebg.png");
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.block1 {
  width: 85%;
  height: 100px;
  margin-top: 10px;
  background: #ffffff;
  box-shadow: 0 4px 6px 0 rgba(22, 45, 113, 0.1);
  border-radius: 4px;
  border-radius: 4px;
  .blockt1 {
    margin-top: 17px;
    margin-left: 15px;
    font-family: PingFangSC-Regular;
    font-size: 12px;
    color: #999999;
    letter-spacing: 0;
  }
  .blockt2 {
    margin-left: 15px;
    font-family: DINCond-Black;
    font-size: 28px;
    font-weight: bold;
    color: #333333;
    letter-spacing: 0.7px;
  }
  .blockt3 {
    margin-left: 15px;
    margin-top: 5px;
    font-family: PingFangSC-Regular;
    font-size: 10px;
    color: #357fff;
  }
  .blockt4 {
    margin-top: 5px;
    margin-left: 5px;
    font-family: PingFangSC-Regular;
    font-size: 12px;
    color: #ff6a6a;
  }
}
// #main1 {
//   width: 80%;
//   height: 450px;
//   margin: 50px auto;
//   border: 1px solid #ddd;
// }
// #main2 {
//   width: 80%;
//   height: 450px;
//   margin: 50px auto;
//   border: 1px solid #ddd;
// }
</style>
